USE [RedemptoristRetreat]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_RetreatSchedule_Retreat]') AND parent_object_id = OBJECT_ID(N'[dbo].[RetreatSchedule]'))
ALTER TABLE [dbo].[RetreatSchedule] DROP CONSTRAINT [FK_RetreatSchedule_Retreat]
GO

USE [RedemptoristRetreat]
GO

/****** Object:  Table [dbo].[RetreatSchedule]    Script Date: 12/01/2013 14:29:42 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RetreatSchedule]') AND type in (N'U'))
DROP TABLE [dbo].[RetreatSchedule]
GO

USE [RedemptoristRetreat]
GO

/****** Object:  Table [dbo].[RetreatSchedule]    Script Date: 12/01/2013 14:29:43 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[RetreatSchedule](
	[scheduleId] [int] IDENTITY(1,1) NOT NULL,
	[retreatId] [int] NOT NULL,
	[startTimestamp] [datetime] NULL,
	[endTimestamp] [datetime] NULL,
	[activeData] [tinyint] NULL,
	[modifiedBy] [varchar](25) NULL,
	[modifiedTimestamp] [datetime] NULL,
	[directorId] [int] NULL,
 CONSTRAINT [PK_RetreatSchedule] PRIMARY KEY CLUSTERED 
(
	[scheduleId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[RetreatSchedule]  WITH NOCHECK ADD  CONSTRAINT [FK_RetreatSchedule_Retreat] FOREIGN KEY([retreatId])
REFERENCES [dbo].[Retreat] ([retreatId])
NOT FOR REPLICATION 
GO

ALTER TABLE [dbo].[RetreatSchedule] CHECK CONSTRAINT [FK_RetreatSchedule_Retreat]
GO

